﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZhouYu.DreamTour.Core;
using ZhouYu.DreamTour.DAL.IRepository;
using ZhouYu.DreamTour.Model;

namespace ZhouYu.DreamTour.DAL.Repository
{
    public class TeamRepository:ITeamRepository
    {
        //团队简介
        public List<TeamInfo> TeamInfo() 
        {
            string sql = $"SELECT `Team_Title` from `teaminfo`";
            return DapperHelper<TeamInfo>.QueryList(sql, null);
        }


        //根据页面标题查询单个对象
        public TeamInfo GetTeam(string name)
        {
            TeamInfo team = new TeamInfo();
            team.Team_Title = name;
            string sql = $"SELECT * FROM `teaminfo` WHERE Team_Title=@Team_Title";
            return DapperHelper<TeamInfo>.QuerySingleOrDefault(sql,team);
        }
    }
}
